﻿<UserControl x:Class="Papercut.Views.MessageDetailPartsListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Behaviors="clr-namespace:Papercut.Behaviors"
             xmlns:cal="http://www.caliburnproject.org"
             mc:Ignorable="d"
             d:DesignHeight="400" d:DesignWidth="600">
    <Grid>
        <DataGrid x:Name="MessagesList" Width="Auto" Height="Auto"
                  VerticalContentAlignment="Stretch" HorizontalAlignment="Stretch" Padding="0" Margin="2"
                  SelectedItem="{Binding SelectedPart,Mode=TwoWay}"
                  cal:Message.Attach="[Event MouseDoubleClick] = [Action ViewSection]"
                  ItemsSource="{Binding Parts}" AutoGenerateColumns="False" IsReadOnly="True">
            <DataGrid.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Save As..." IsEnabled="{Binding Path=HasSelectedPart}"
                              cal:Message.Attach="SaveAs" />
                </ContextMenu>
            </DataGrid.ContextMenu>
            <DataGrid.Columns>
                <DataGridTextColumn Header="Media Type" Binding="{Binding ContentType.MediaType}" />
                <DataGridTextColumn Header="Media Subtype" Binding="{Binding ContentType.MediaSubtype}" />
                <DataGridTextColumn Header="Charset" Binding="{Binding ContentType.Charset}" />
                <DataGridTextColumn Header="Filename" Binding="{Binding FileName}" />
            </DataGrid.Columns>
        </DataGrid>

    </Grid>
</UserControl>